package com.example.tys.skindemo;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.example.tys.skindemo.resPluginConfig.SkinConfig;
import com.example.tys.skindemo.resPluginCore.ResPluginImpl;

import java.io.IOException;

public class MainActivity extends AppCompatActivity {

    private String plguinPath = Environment.getExternalStorageDirectory() + "/plugin.apk";
    private ImageView iv;
    private ResPluginImpl plug;
    private Button bt;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        iv = (ImageView) findViewById(R.id.iv);
        bt = (Button) findViewById(R.id.bt);

        FragmentTransaction a = getSupportFragmentManager().beginTransaction();
        a.add(R.id.mfl, new BlankFragment());
        a.commit();
    }

    public void plugin(View view) throws IOException {
        ResPluginImpl.getsInstance().setRes(this, "_blue");
        ResPluginImpl.getsInstance().setTypeFace(this.getBaseContext(), "specified.ttf");
        ResPluginImpl.getsInstance().setStatusBarColor(this, "skin_colorPlugin_blue");
        ResPluginImpl.getsInstance().setNavigateBarColor(this, "skin_colorPlugin_blue");
    }

    public void blue(View view) {
        ResPluginImpl.getsInstance().setRes(this, "");
        ResPluginImpl.getsInstance().setTypeFace(this, "");
        ResPluginImpl.getsInstance().setStatusBarColor(this, "");
        ResPluginImpl.getsInstance().setNavigateBarColor(this, "");
    }

    public void other(View view) {
        Intent i = new Intent(this.getBaseContext(), Main2Activity.class);
        startActivity(i);
    }

}
